using UnityEngine;

public class LightMove : MonoBehaviour
{
	public Transform m_transform;

	public UISprite cursprite;

	public float speed;

	public bool isrun;

	private float temptime;

	public float intertime;

	public float startx;

	public float endx;

	private void Start()
	{
		m_transform = base.transform;
		startx *= GlobalInf.screenRatioWidth / 800f;
		endx *= GlobalInf.screenRatioWidth / 800f;
	}

	private void Update()
	{
		if (isrun)
		{
			m_transform.Translate(speed * Time.deltaTime, 0f, 0f, Space.Self);
			float num = endx;
			Vector3 localPosition = m_transform.localPosition;
			if (num - localPosition.x < 1f)
			{
				isrun = false;
				cursprite.enabled = false;
				temptime = 0f;
				intertime = UnityEngine.Random.Range(8, 20);
			}
		}
		else
		{
			temptime += Time.deltaTime;
			if (temptime > intertime)
			{
				m_transform.localPosition = new Vector3(startx, 0f, 0f);
				cursprite.enabled = true;
				isrun = true;
			}
		}
	}
}
